const getText = (url: any) => {
  const promise = new Promise(function (resolve, reject) {
    const client = new XMLHttpRequest()
    client.open('GET', url)
    client.onreadystatechange = handler
    client.responseType = 'text'
    client.setRequestHeader('Accept', 'text/plan')
    client.send()

    function handler() {
      if (client.readyState !== 4) {
        return
      }
      if (client.status === 200) {
        resolve(client.response)
      } else {
        reject(new Error(client.statusText))
      }
    }
  })
  return promise
}
export default getText